/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.pictavore.plugin.tool

import java.util.List
import java.util.ArrayList

import com.google.inject.Singleton
import com.google.inject.Inject
import com.pictavore.plugin.PluginManager
import com.pictavore.plugin.Plugin

/**
 *
 * @author caleb
 */
@Singleton
class ToolPluginManager {
    @Inject PluginManager pluginManager
    List<ToolPlugin> toolPlugins

    def getToolPlugins() {
        if (toolPlugins == null) {
            toolPlugins = new ArrayList<ToolPlugin>()

            pluginManager.plugins.each { Plugin plugin ->
                if (plugin instanceof ToolPlugin) {
                    toolPlugins << plugin
                }
            }
        }

        toolPlugins
    }
}

